<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/common/meta.jsp"></jsp:include>
<jsp:include page="/common/resource.jsp"></jsp:include>
<title>登录页面</title>
</head>

<body class="theme-login-layout" style="overflow: hidden;">
	<div class="theme-login-header"></div>
	<div id="theme-login-form">
		<div class="QRcode"></div>
		<div class="QRcode-layout hide">
			<div class="QRcode-layout-close"></div>
			<div class="QRcode-header">
				<b>APP扫码登录</b> <span>请使用最新版APP进行扫码登录</span>
			</div>
			<div class="QRcode-content">
				<img src="themes/css/images/QRcode-demo.png" width="215">
			</div>
		</div>

		<form id="loginForm" class="theme-login-form" method="post">
			<dl>
				<dt>
					<img src="themes/css/images/logo_110.png">
				</dt>

				<!--    <dd>
                        	<select id="theme-login-select" class="theme-login-select" style="width:100%;">   
                            	<option value="0">请选择用户类型</option>  
                                <option value="1">教师</option>   
                                <option value="2">学生</option>  
                            </select>  
                        </dd> -->
				<!--  <dd>
                        	<hgroup class="group-mail">
                        	<input id="mail" name="mail" />
                            <label>@</label>
                            <select id="mail-add" style="width:120px;">   
                            	<option value="0">insdep.com</option>  
                                <option value="1">weavors.com</option>   
                                <option value="2">educate.net.cn</option>  
                            </select>
                            </hgroup>
                        </dd> -->
				<dd>
					<input id="login_name" name="login_name" class="theme-login-text" style="width:100%;" />
				</dd>
				<dd>
					<input id="password" name="password" class="theme-login-text" style="width:100%;" />
				</dd>
				<!-- <dd><input id="code" name="code" class="theme-login-text"  style="width:100%;"/></dd>
                        <dd><input id="smscode" name="smscode" class="theme-login-text" style="width:300px;"></dd> -->
				<dd>
					<a class="submit" href="javascript:void(0)" onclick="login()" >Sign in</a>
					<a class="easyui-linkbutton button" href="index.html">forgotten ?</a>
				</dd>

			</dl>
		</form>
	</div>

	<div class="theme-login-footer" style="text-align: center;">
		<dl>
			<dt>
				<a>免费加入</a> | <a id="ok">产品优势</a> | <a>系列产品</a> | <a>应用下载</a> | <a>帮助手册</a> | <a>联系我们</a>
			</dt>
			<dd>
				&copy 2007 -
				<script>var year = new Date();
					document.write(year.getFullYear());
				</script>
				宁波市维沃信息科技有限公司.版权所有
			</dd>
		</dl>
	</div>

	<script>
	
		$(function() {
	
			$(".QRcode").on("click", function() {
				$(".QRcode-layout").removeClass("hide");
	
			});
			$(".QRcode-layout-close").on("click", function() {
				$(".QRcode-layout").addClass("hide");
			});
	
			$.extend($.fn.validatebox.defaults.tipOptions, {
				onShow : function() {
					$(this).tooltip("tip").css({
						backgroundColor : "#ff7e00",
						border : "none",
						color : "#fff"
					});
	
				}
			})
	
			/*布局部分*/
			$('#theme-login-layout').layout({
				fit : true /*布局框架全屏*/
			});
	
			/*表单定义*/
			//$('#theme-login-select').combobox({    
			/*通过ajax取数据
			url:'userclass.json',    
			valueField:'id',
			textField:'text'
			*/
			//editable:false /*不允许用户通过输入选择*/
	
			//});  
			//var selects=$('#theme-login-select').combobox('panel');
			//selects.panel({cls:"theme-login-select-panel"}); 
	
			/* $('#mail').textbox({    
				prompt:'mail',
				required:true,
				missingMessage:"请输入邮箱名称"
			}); */
	
			//$('#mail-add').combobox({    
			/*通过ajax取数据
			url:'userclass.json',    
			valueField:'id',
			textField:'text'
			*/
			//	editable:false /*不允许用户通过输入选择*/
			//	
			//});  
			//var mailselect=$('#mail-add').combobox('panel');
			//mailselect.panel({cls:"theme-mail-select-panel"}); 
	
			$('#login_name').textbox({
				prompt : 'Account or number',
				required : true,
				missingMessage : "请输入用户名"
			});
			$('#password').textbox({
				type : "password",
				prompt : 'Password',
				required : true,
				missingMessage : "请输入密码"
			});
			$('#code').textbox({
				prompt : 'Code',
				required : true,
				missingMessage : "请输入验证码"
			})
	
			$('#smscode').textbox({
				required : true,
				missingMessage : "请输入短信验证码",
				buttonText : '获取短信验证码',
				prompt : '短信验证码'
			});
	
			$('.submit').linkbutton({
			});
	
			/*验证码tooltip*/
			$('#form').form({
				url : "http://www.insdep.com/",
				onSubmit : function() {
					var res = $(this).form('enableValidation').form('validate');
					res ? $.messager.progress() : "";
					return res;
				},
				success : function(data) {
					$.messager.progress('close');
					try {
						var data = eval('(' + data + ')');
						if (!data.success) {
							$.messager.alert('提示', data.message, 'error', function() {
								$('#login_name,#password').textbox('clear');
							});
						} else {
							window.location.reload();
						}
					} catch (e) {
						$.insdep.error(data);
					}
	
				}
			});
	
		});
		
		
		/*验证码tooltip*/
		function login() {
			/**验证数据**/
			if (!ValidateForm("#loginForm")) {
				return;
			}
			$.ajax({
				url : 'dologin',
				data : $("#loginForm").serialize(),
				type : "POST",
				beforeSend : function() {
					wait();
					$("#image_no").blur();
				},
				complete : function() {
					/* 	$.messager.progress("close"); */
				},
				success : function(data) {
					var flag = data.flag;
					if (flag) { //验证成功
						window.location = "${base}/index";
					} else { //验证失败
						$.unblockUI();
						$("#image_no").blur();
						var type = data.type;
						var msg = data.msg;
						eventType = type;
						$("#imgValidateCode").attr("src", "${base}/getValidateCode");
						winObj = $.messager.alert('提示', msg, 'info', function() {
							//failCallBack(type);
						});
					}
				}
			});
		}
		/** 开启遮罩层*/
		function wait() {
			$.blockUI({
				message : '<img src=\"${base}/themes/css/images/large-loading.gif\" alt=\"请等待，正在处理...\">'
			});
		}
	</script>
</body>

</html>
